home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 42.4 KB | 1,181 lines | [TEXT/MPS ] |
- {
- File: BlockStoragePlugin.p
-
- Contains: Block Storage Plug In Programming Interface
-
- Version: Technology: Copland
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- }
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT BlockStoragePlugin;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __BLOCKSTORAGEPLUGIN__}
- {$SETC __BLOCKSTORAGEPLUGIN__ := 1}
-
- {$I+}
- {$SETC BlockStoragePluginIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
- {$IFC UNDEFINED __TYPES__}
- {$I Types.p}
- {$ENDC}
- {$IFC UNDEFINED __ERRORS__}
- {$I Errors.p}
- {$ENDC}
- {$IFC UNDEFINED __FILEMANAGERTYPES__}
- {$I FileManagerTypes.p}
- {$ENDC}
- {$IFC UNDEFINED __NAMEREGISTRY__}
- {$I NameRegistry.p}
- {$ENDC}
- {$IFC UNDEFINED __BLOCKSTORAGE__}
- {$I BlockStorage.p}
- {$ENDC}
- {$IFC UNDEFINED __IOMEMORYLISTS__}
- {$I IOMemoryLists.p}
- {$ENDC}
-
- {$PUSH}
- {$ALIGN POWER}
- {$LibExport+}
-
- {$IFC FOR_SYSTEM8_PREEMPTIVE }
- {
- ******************************************************************************
- *******************************************************************************
- *******************************************************************************
-
- Plug In Constants
-
- *******************************************************************************
- *******************************************************************************
- *****************************************************************************
- }
- {
- ******************************************************************************
-
- Options to a BSIOFunc
-
- *****************************************************************************
- }
-
- CONST
- kBSRead = 0;
- kBSWrite = 1;
-
- {
- ******************************************************************************
-
- Mapping Plug-In Level of Confidence values
-
- *****************************************************************************
- }
- kBSMPIDeviceNotSupported = 0;
- kBSMPIDeviceTypeRecognized = 1;
- kBSMPIDeviceMfrRecognized = 2;
- kBSMPIDeviceModelRecognized = 3;
- kBSMPIDeviceMediaRecognized = 4;
-
-
- TYPE
- BSMPIConfidenceLevel = UInt32;
- {
- ******************************************************************************
-
- Mapping Plug-In Level of Confidence values
-
- *****************************************************************************
- }
-
- CONST
- kBSCPIDeviceNotSupported = 0;
- kBSCPIDeviceTypeRecognized = 1;
- kBSCPIDeviceMfrRecognized = 2;
- kBSCPIDeviceModelRecognized = 3;
-
-
- TYPE
- BSCPIConfidenceLevel = UInt32;
- {
- ******************************************************************************
-
- Plug In Version - this tracks the revision of the plug-in interface and
- should be placed in the version field of the plug-in interface structure
-
- *****************************************************************************
- }
-
- CONST
- kBSPlugInInterfaceVersion = $02011996;
-
- {
- ******************************************************************************
-
- BSIOStatus values
-
- *****************************************************************************
- }
- kBSIOCompleted = 1;
- kBSIOContinuing = 2;
- kBSIOFailed = 3;
- kBSIONotStarted = 4;
-
-
- TYPE
- BSIOStatus = UInt32;
- {
- ******************************************************************************
- *******************************************************************************
- *******************************************************************************
-
- Types
-
- *******************************************************************************
- *******************************************************************************
- *****************************************************************************
- }
- BSStorePtr = Ptr;
- BSContainerPtr = Ptr;
- BSIORequestBlockPtr = Ptr;
- BSIOErrors = OSStatus;
- {
- ******************************************************************************
- BSErrorList: another structure to manage I/O success/failure.
-
- BSErrorList data structure allows a Mapping Plug-In to keep track of the
- current state of each transfer request sent to it by the Block Storage client. If transfers complete
- successfully, a pointer 0 is returned. If an error occurs, a linked list (?) of these data structures
- is returned specifying the exact state of each transfer request.
-
- startingBlock: The initial transfer block of this fragment of the request
- blockCount: The number of blocks to be transfered including the startingBlock
- status: A constant representing the final state of the transfer of the blocks:
- kIONotStarted: No processing was begun on these blocks
- kIOStarted: The BS Plug-In began to process the blocks
- kIOToFamily: The request was sent to the device family
- kIOComplete: The request completed normally
- kIOFailed: The request failed to complete execution
- error: The exact error, if any
- xferID: An index representing which request of a multiple-request I/O this is
- next: A pointer to the next data structure (could be eliminated in favor of indices)
- *****************************************************************************
- }
- BSErrorListPtr = ^BSErrorList;
- BSErrorList = RECORD
- startingBlock: BSByteCount;
- length: BSByteCount;
- status: UInt32;
- error: BSIOErrors;
- xferID: ItemCount;
- next: BSErrorListPtr;
- END;
-
- {
- ****************************************************************************
-
- BSStoreMPIComponent describes a component of a Store. A component may
- be an external device or another Store. This is the internal form of
- BSStoreComponent.
-
- ***************************************************************************
- }
- BSStoreMPIComponentPtr = ^BSStoreMPIComponent;
- BSStoreMPIComponent = RECORD
- componentType: BSComponentType;
- startingOffset: BSByteCount; { Where in the Store this }
- { component will be placed }
- sourceNode: RegEntryRef; { Physical components }
- srcStore: BSStorePtr; { Logical components }
- partitionInfo: BSPartitionDescriptor; { Logical components }
- END;
-
- {
- ******************************************************************************
-
- BSStoreMPIInfo - Information about the Store that the Mapping Plug-in can
- provide
-
- *****************************************************************************
- }
- BSStoreMPIInfoPtr = ^BSStoreMPIInfo;
- BSStoreMPIInfo = RECORD
- curState: BSAccessibilityState;
- storeSize: BSByteCount;
- readBlockSize: BSByteCount; { minimum read size & granularity }
- writeBlockSize: BSByteCount; { minimum write size & granularity }
- isEjectable: BOOLEAN;
- isWriteable: BOOLEAN;
- hasAutoEjectHardware: BOOLEAN;
- isFormattable: BOOLEAN;
- isPartitionable: BOOLEAN;
- isFilesystem: BOOLEAN;
- reserved1: BOOLEAN;
- reserved2: BOOLEAN;
- curFormat: BSStoreFormatInfo;
- possibleFormats: ARRAY [0..7] OF BSStoreFormatInfo;
- name: PACKED ARRAY [0..47] OF CHAR;
- END;
-
- {
- ******************************************************************************
-
- BSStorePPIInfo - Information about the Store that the Partitioning Plug-in
- can provide
-
- *****************************************************************************
- }
- BSStorePPIInfoPtr = ^BSStorePPIInfo;
- BSStorePPIInfo = RECORD
- numPartitions: ItemCount;
- maxPartitions: ItemCount;
- END;
-
- {
- ******************************************************************************
-
- BSContainerPIInfo - Information about the Container that the Container
- Plug-in can provide
-
- *****************************************************************************
- }
- BSContainerPIInfoPtr = ^BSContainerPIInfo;
- BSContainerPIInfo = RECORD
- numChildren: ItemCount;
- isEjectable: BOOLEAN;
- END;
-
- {
- ******************************************************************************
- *******************************************************************************
- *******************************************************************************
-
- Plug-In Interface Functions
-
- *******************************************************************************
- *******************************************************************************
- *****************************************************************************
- }
- {
- ******************************************************************************
- *******************************************************************************
-
- Mapping Plug-In Interface
-
- *******************************************************************************
- *****************************************************************************
- }
- {
- ******************************************************************************
- BSMappingPIExamine - Plug-in's opportunity to examine a device and determine
- if it is an appropriate plug-in for it
-
- Inputs: examineStore - a pointer to the in-process Store to be examined
-
- Outputs: confidence - level of confidence the plug-in has that the plugin
- is the correct one
-
- Returns: E_BSSuccess if no errors happened examining the device.
- If an error happened, the error received from the other family is
- returned
- *****************************************************************************
- }
- BSMappingPIExamine = ProcPtr; { FUNCTION BSMappingPIExamine(examineStore: BSStorePtr; VAR confidence: BSMPIConfidenceLevel): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSMappingPIInit - Plug-in's initialization routine. Called when plug-in
- is selected for a Store. Plug-in's opportunity to initialize
- device, allocate data structures, etc.
-
- Inputs: initStore - a pointer to the Store this plug-in will be attached
- to
- Outputs: curState - the current state of the media
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSMappingPIInit = ProcPtr; { FUNCTION BSMappingPIInit(initStore: BSStorePtr): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSMappingPICleanup - Plug-in's dispose routine. Called when Store is
- being disposed of. Should dispose of any memory or data structures
- held for this Store, finalize all I/O for Store
-
- Inputs: cleanupStore - Store that is being disposed of
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSMappingPICleanup = ProcPtr; { FUNCTION BSMappingPICleanup(cleanupStore: BSStorePtr): OSStatus; C; }
-
- {
- ******************************************************************************
- BSMappingPIIO - Plug-in's input/output routine
-
- Inputs: ioStore - the Store on which IO is to be performed
- blocks - descriptor of the blocks to do IO on
- memory - descriptor of the memory to do IO on (memory has been prepared)
- parentRequest - the request this request is being made on behalf of
- options - read/write
-
- Outputs: errors - where exactly the errors occured, if any
-
- Returns: kBSIOContinuing if IO was started successfully and the I/O
- completion routine still needs to be called
- kBSIOCompleted if IO was completed and no further action is
- necessary
- kBSIOFailed if IO failed for some reason
- kBSIONotStarted if the IO could not be started
- *****************************************************************************
- }
- BSMappingPIIO = ProcPtr; { FUNCTION BSMappingPIIO(ioStore: BSStorePtr; blocks: BSBlockListDescriptorRef; memory: MemListDescriptorRef; parentRequest: BSIORequestBlockPtr; options: OptionBits; VAR errors: BSErrorListPtr): BSIOStatus; C; }
-
- {
- ******************************************************************************
- BSMappingPIFlush - flush plug-in's cached data (if any)
- BSMappingPIFlush flushes the plug-in's cached data. It is called
- in a similar fashion to an I/O request. BSStoreRW may be used
- as may BSStoreFlush.
-
- Inputs: flushStore - the Store on which flush is to be performed
- parentRequest - the request this request is being made on behalf of
-
- Outputs: errors - where exactly the errors occured, if any
-
- Returns: kBSIOContinuing if IO was started successfully and the I/O
- completion routine still needs to be called
- kBSIOCompleted if IO was completed and no further action is
- necessary
- kBSIOFailed if IO failed for some reason
- kBSIONotStarted if the IO could not be started
- *****************************************************************************
- }
- BSMappingPIFlush = ProcPtr; { FUNCTION BSMappingPIFlush(ioStore: BSStorePtr; parentRequest: BSIORequestBlockPtr; VAR errors: BSErrorListPtr): BSIOStatus; C; }
-
- {
- ******************************************************************************
- BSMappingPIAddComponent - Notifies Plug-in about new components to be added
- to it
-
- Inputs: destStore - the Store the blocks are to be mapped into
- newComponent - the new Component to be mapped in
-
- Outputs: storeNewInfo - the new information about the Store
-
-
- Returns: E_BSSuccess if successful
- E_BSMPITooManyMappings if no more mappings can be handled
- E_BSMPIOutOfStoreBounds if the start of the destination blocks
- would cause a gap in the Store
-
- *****************************************************************************
- }
- BSMappingPIAddComponent = ProcPtr; { FUNCTION BSMappingPIAddComponent(destStore: BSStorePtr; VAR newComponent: BSStoreMPIComponent; VAR storeNewInfo: BSStoreInfo): OSStatus; C; }
-
- {
- ******************************************************************************
- BSMappingPIGoToState - Requests plug-in to take Store to the specified
- accessibility state.
-
- Inputs: theStore - Store to take to the state
- gotoState - what state to go to (possible states defined above)
-
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSMappingPIGoToState = ProcPtr; { FUNCTION BSMappingPIGoToState(theStore: BSStorePtr; gotoState: BSAccessibilityState): OSStatus; C; }
-
- {
- ******************************************************************************
- BSMappingPIFormatMedia - tells plug-in to do a low-level format of the media
-
- Inputs: formatStore - Store to format
-
- Outputs: <none>
-
- Returns: E_BSSuccessful if successful
-
- *****************************************************************************
- }
- BSMappingPIFormatMedia = ProcPtr; { FUNCTION BSMappingPIFormatMedia(formatStore: BSStorePtr; formatType: BSFormatIndex): OSStatus; C; }
-
- {
- ******************************************************************************
- BSMappingPIGetInfo - gets information about the device and the plug-in
-
- Inputs: formatStore - Store to format
-
- Outputs: info - the filled in information
-
- Returns: E_BSSuccessful if successful
-
- *****************************************************************************
- }
- BSMappingPIGetInfo = ProcPtr; { FUNCTION BSMappingPIGetInfo(infoStore: BSStorePtr; VAR info: BSStoreMPIInfo): OSStatus; C; }
-
- {
- ******************************************************************************
- BSMappingIOCompletion - I/O completion routine for a mapping plug-in
-
- Inputs: theStore: - A pointer to the Store in question
- finishedPrivateData - A pointer to the private data the Mapping
- plug-in associated with this I/O
- returnedBSErrorList - A pointer to a BSErrorList if the
- triggering event came from another BS plug-in
- returnedStatus - The OSStatus returned by the other family or
- plug-in that was called
- Outputs: errorListPtrPtr - A pointer to a pointer to a BSErrorList.
- The BSErrorList is allocated and filled in by the completion
- routine if the I/O has failed. It should be allocated using
- BSErrorListAllocate and will be deallocated by the family code.
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSMappingIOCompletion = ProcPtr; { FUNCTION BSMappingIOCompletion(theStore: BSStorePtr; finishedPrivateData: UNIV Ptr; returnedBSErrorList: BSErrorListPtr; returnedStatus: OSStatus; VAR errorListPtrPtr: BSErrorListPtr): OSStatus; C; }
-
- BlockStoragePlugInInfoPtr = ^BlockStoragePlugInInfo;
- BlockStoragePlugInInfo = RECORD
- version: UInt32;
- reserved1: UInt32;
- reserved2: UInt32;
- reserved3: UInt32;
- END;
-
- BSStoreMappingOpsPtr = ^BSStoreMappingOps;
- BSStoreMappingOps = RECORD
- header: BlockStoragePlugInInfo;
- DeviceExamine: BSMappingPIExamine;
- Init: BSMappingPIInit;
- Cleanup: BSMappingPICleanup;
- IO: BSMappingPIIO;
- Flush: BSMappingPIFlush;
- AddComponent: BSMappingPIAddComponent;
- GotoState: BSMappingPIGoToState;
- Format: BSMappingPIFormatMedia;
- GetInfo: BSMappingPIGetInfo;
- ioCompletion: BSMappingIOCompletion;
- END;
-
- {
- ******************************************************************************
-
- BSMPIBackgroundTask - a background task entry point for a Mapping plug-in.
- BSMPIStartBackgroundTask may be used by the Mapping plug-in to
- start one of these. The task will be automatically terminated
- after the Cleanup routine is executed
-
- Inputs: theStore - the Store this is running for
- theArg - the argument passed to BSMPIStartBackgroundTask
-
- Outputs: <none>
-
- Returns: Errors are ignored but will be logged.
- *****************************************************************************
- }
- BSMPIBackgroundTask = ProcPtr; { FUNCTION BSMPIBackgroundTask(theStore: BSStorePtr; theArg: UNIV Ptr): OSStatus; C; }
-
- {
- ******************************************************************************
- *******************************************************************************
-
- Partitioning Plug-In Interface
-
- *******************************************************************************
- *****************************************************************************
- }
- {
- ******************************************************************************
- BSPartitioningPIExamine - Plug-in's opportunity to examine a Store and
- determine if it's the right plug-in for it
-
- Inputs: readStoreConn - a connection to the Store to be examined
-
- Outputs: certainty - 0 if the plug-in did not recognize the partition
- map format
- otherwise the number of bytes read
-
- Returns: E_BSSuccess if no errors occured
- E_BSPPIOutOfResources if memory or other resource couldn't
- be allocated
- otherwise the Block Storage error from the I/O
-
- *****************************************************************************
- }
- BSPartitioningPIExamine = ProcPtr; { FUNCTION BSPartitioningPIExamine(readStoreConn: BSStoreConnID; VAR certainty: UInt32): OSStatus; C; }
-
- {
- ******************************************************************************
- BSPartitioningPIInit - Plug-in's initialization routine. Called when
- plug-in is selected for a Store. Plug-in's opportunity to
- initialize device, allocate data structures, etc.
-
- Inputs: initStore - pointer to the Store the plug-in is being attached to
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSPartitioningPIInit = ProcPtr; { FUNCTION BSPartitioningPIInit(initStore: BSStorePtr): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSPartitioningPICleanup - Plug-in's dispose routine. Called when Store is
- being disposed of. Should dispose of any memory or data structures
- held for this Store and flush the partition map if necessary
-
- Inputs: cleanupStore - Store that is being disposed of
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSPartitioningPICleanup = ProcPtr; { PROCEDURE BSPartitioningPICleanup(cleanupStore: BSStorePtr); C; }
-
- {
- ******************************************************************************
- BSPartitioningPIInitializeMap - lays down a new partition map on a Store (plug-in has
- already been attached)
-
- Inputs: initStore - the Store to be initialized
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
- otherwise, Block Storage error if I/O fails
-
- *****************************************************************************
- }
- BSPartitioningPIInitializeMap = ProcPtr; { FUNCTION BSPartitioningPIInitializeMap(initStore: BSStorePtr): OSStatus; C; }
-
- {
- ******************************************************************************
- BSPartitioningPIGetInfo - Gets information about the partition map and the
- partitioning plug-in
-
- Inputs: store - the Store to read from
-
- Outputs: info - the filled in information
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSPartitioningPIGetInfo = ProcPtr; { FUNCTION BSPartitioningPIGetInfo(store: BSStorePtr; VAR info: BSStorePPIInfo): OSStatus; C; }
-
- {
- ******************************************************************************
- BSPartitioningPIGetEntry - Get a particular partition map entry
-
- Inputs: readStore - the Store
- entryNum - which entry to read
-
- Outputs: retEntry - pointer to a BSPartitionDescriptor that's filled in
- with the entry
-
- Returns: E_BSSuccess if successful
- E_BSPPIPartitionNonExistant if that entry does not exist
- other Block Storage error if I/O problem
-
- *****************************************************************************
- }
- BSPartitioningPIGetEntry = ProcPtr; { FUNCTION BSPartitioningPIGetEntry(readStore: BSStorePtr; entryNum: ItemCount; VAR retEntry: BSPartitionDescriptor): OSStatus; C; }
-
- {
- ******************************************************************************
- BSPartitioningSetEntry - Sets the information in a particular partition map
- entry
-
- Inputs:
-
- Outputs:
-
- Returns:
-
- *****************************************************************************
- }
- BSPartitioningPISetEntry = ProcPtr; { FUNCTION BSPartitioningPISetEntry(store: BSStorePtr; partitionNum: ItemCount; VAR partitionInfo: BSPartitionDescriptor): OSStatus; C; }
-
- BSStorePartitioningOpsPtr = ^BSStorePartitioningOps;
- BSStorePartitioningOps = RECORD
- header: BlockStoragePlugInInfo;
- Examine: BSPartitioningPIExamine;
- Init: BSPartitioningPIInit;
- Cleanup: BSPartitioningPICleanup;
- InitializeMap: BSPartitioningPIInitializeMap;
- GetInfo: BSPartitioningPIGetInfo;
- GetEntry: BSPartitioningPIGetEntry;
- SetEntry: BSPartitioningPISetEntry;
- END;
-
- {
- ******************************************************************************
- *******************************************************************************
-
- Container Plug-In Interface
-
- *******************************************************************************
- *****************************************************************************
- }
- {
- ******************************************************************************
-
- BSContainerPIExamine - Called to allow the Container plug-in to verify
- that it is correct for the Container
-
- Inputs: initContainer - the Container in question
-
- Outputs: levelOfConfidence - how confident the plug-in is that it is the
- correct one
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSContainerPIExamine = ProcPtr; { FUNCTION BSContainerPIExamine(initContainer: BSContainerPtr; VAR levelOfConfidence: BSCPIConfidenceLevel): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSContainerPIInit - Plug-in's initialization routine. Called when
- plug-in is selected for a Container. Plug-in's opportunity to
- initialize device, allocate data structures, etc.
-
- Inputs: initContainer - a pointer to the Container this plug-in will
- be attached to
- Outputs: info - information about the new Container
- backgroundTask - if true, the BackgroundTask entry point will
- be invoked in its own private task.
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSContainerPIInit = ProcPtr; { FUNCTION BSContainerPIInit(initContainer: BSContainerPtr; VAR info: BSContainerPIInfo; VAR backgroundTask: BOOLEAN): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSContainerPICleanup - cleans up plug-in state
-
- Inputs: container - the Container to clean up for
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSContainerPICleanup = ProcPtr; { FUNCTION BSContainerPICleanup(container: BSContainerPtr): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSContainerPIGoToState - Tells the Container to go the specified state
-
- Inputs: container - the Container to take to the state
- accessState - the state to go to
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSContainerPIGoToState = ProcPtr; { FUNCTION BSContainerPIGoToState(container: BSContainerPtr; accessState: UInt32): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSContainerPIAddContainer - Informs the Container of a new sub-Container
- being added
-
- Inputs: destContainer - the Container we're adding to
- addedContainer - the Container being added
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSContainerPIAddContainer = ProcPtr; { FUNCTION BSContainerPIAddContainer(destContainer: BSContainerPtr; addedContainer: BSContainerPtr): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSContainerPIGetInfo - Gets information about a Container
-
- Inputs: infoContainer - the Container to get information about
-
- Outputs: info - the filled in information buffer
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- BSContainerPIGetInfo = ProcPtr; { FUNCTION BSContainerPIGetInfo(infoContainer: BSContainerPtr; VAR info: BSContainerPIInfo): OSStatus; C; }
-
- {
- ******************************************************************************
-
- BSContainerPIBackgroundTask - an optional entry point that will be executed
- within its own task context if the backgroundTask flag is set on exit
- from the Container Plug-in's init routine
-
- Inputs: container - the Container the Background Task is being invoked
- on behalf of
-
- Outputs: <none>
-
- Returns: E_BSSuccessful if successful
-
- *****************************************************************************
- }
- BSContainerPIBackgroundTask = ProcPtr; { FUNCTION BSContainerPIBackgroundTask(container: BSContainerPtr): OSStatus; C; }
-
- BSContainerPolicyOpsPtr = ^BSContainerPolicyOps;
- BSContainerPolicyOps = RECORD
- header: BlockStoragePlugInInfo;
- Examine: BSContainerPIExamine;
- Init: BSContainerPIInit;
- Cleanup: BSContainerPICleanup;
- GoToState: BSContainerPIGoToState;
- AddContainer: BSContainerPIAddContainer;
- GetInfo: BSContainerPIGetInfo;
- BackgroundTask: BSContainerPIBackgroundTask;
- END;
-
- {
- ******************************************************************************
-
- BSCPIBackgroundTask - a background task entry point for a Container plug-in.
- BSCPIStartBackgroundTask may be used by the Container plug-in to
- start one of these. The task will be automatically terminated
- after the Cleanup routine is executed
-
- Inputs: theContainer - the Container this is running for
- theArg - the argument passed to BSMPIStartBackgroundTask
-
- Outputs: <none>
-
- Returns: Errors are ignored but will be logged.
- *****************************************************************************
- }
- BSCPIBackgroundTask = ProcPtr; { FUNCTION BSCPIBackgroundTask(theContainer: BSContainerPtr; theArg: UNIV Ptr): OSStatus; C; }
-
- {
- ******************************************************************************
- *******************************************************************************
- *******************************************************************************
-
- Block Storage Family Services
-
- *******************************************************************************
- *******************************************************************************
- *****************************************************************************
- }
- {
- ******************************************************************************
- BSStoreRW - Request I/O from another Store. Used by Mapping Plug-ins.
- Not for use by Partitioning Plug-ins!!
-
- Inputs: rwStore - the Store to do I/O with
- blocks - the blocks for the transfer
- memory - the memory for the transfer
- parentRequest - the BSIORequestPtr that the requestor was called
- with
- privateData - pointer to be given to the completion routine
- when it is called
- options - read/write
-
- Outputs: errors - where errors occurred, if any occurred
-
- Returns: return code from other plug-in
-
- *****************************************************************************
- }
- FUNCTION BSStoreRW(rwStore: BSStorePtr; blocks: BSBlockListDescriptorRef; memory: MemListDescriptorRef; parentRequest: BSIORequestBlockPtr; privateData: UNIV Ptr; options: OptionBits; VAR errors: BSErrorListPtr): BSIOStatus; C;
- {
- ******************************************************************************
- BSStoreFlush - Request another Store to flush its caches. Used by Mapping Plug-ins.
- Not for use by Partitioning Plug-ins!!
-
- Inputs: flushStore - the Store to flush
- parentRequest - the BSIORequestPtr that the requestor was called
- with
- privateData - pointer to be given to the completion routine
- when it is called
-
- Outputs: errors - where errors occurred, if any occurred
-
- Returns: return code from other plug-in
-
- *****************************************************************************
- }
- FUNCTION BSStoreFlush(flushStore: BSStorePtr; parentRequest: BSIORequestBlockPtr; privateData: UNIV Ptr; VAR errors: BSErrorListPtr): BSIOStatus; C;
- {
- ******************************************************************************
- BSTrackOtherFamilyRequest - informs the Block Storage family code what routine
- should be called when the other I/O family the request is being passed to
- notifies the Block Storage family of its completion. The Mapping plug-in's
- ioCompletion routine will be called when the notification of the request
- completion is received.
-
- Inputs: ioStore - Store I/O is taking place in
- curRequest - BSIORequestBlock for which this I/O is taking place.
- This was the BSIORequestBlockPtr passed into the R/W
- routine.
- privateData - Private data to be passed back when the completion routine
- is called.
- retNotify - Pointer to a kernel notification structure that will
- be filled in by BSTrackOtherFamilyRequest to be given
- to the other family in the async API call
-
- Outputs: <none>
-
- Returns: E_BSSuccess if able to track request
-
- *****************************************************************************
- }
- FUNCTION BSTrackOtherFamilyRequest(ioStore: BSStorePtr; curRequest: BSIORequestBlockPtr; privateData: UNIV Ptr; retNotify: KernelNotificationPtr): OSStatus; C;
- {
- ******************************************************************************
- BSMPIStartBackgroundTask - starts a background task for a Mapping Plug-in.
- The task will be terminated after the Cleanup routines for the Plug-in
- is called for this Store.
-
- Inputs: store - the Store the background task is being started for
- backgroundTask - the function to start
- arg - the argument to be passed to the function
-
- Outputs: taskID - the task ID of the new task
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- FUNCTION BSMPIStartBackgroundTask(store: BSStorePtr; backgroundTask: BSMPIBackgroundTask; arg: UNIV Ptr; VAR taskID: TaskID): OSStatus; C;
- {
- ******************************************************************************
- BSCPIStartBackgroundTask - starts a background task for a Container Plug-in.
- The task will be terminated after the Cleanup routines for the Plug-in
- is called for this Container.
-
- Inputs: container - the Container the background task is being started for
- backgroundTask - the function to start
- arg - the argument to be passed to the function
-
- Outputs: taskID - the task ID of the new task
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- FUNCTION BSCPIStartBackgroundTask(container: BSContainerPtr; backgroundTask: BSCPIBackgroundTask; arg: UNIV Ptr; VAR taskID: TaskID): OSStatus; C;
- {
- ******************************************************************************
- *******************************************************************************
-
- Store Accessor functions
-
- *******************************************************************************
- *****************************************************************************
- }
- {
- ******************************************************************************
- BSGetMappingPIPrivateData - retrieves the Mapping Plug-in's private data
- from a Store
-
- Inputs: accessStore - the Store to retrieve the data from
-
- Outputs: <none>
-
- Returns: pointer to data
-
- *****************************************************************************
- }
- FUNCTION BSGetMappingPIPrivateData(accessStore: BSStorePtr): Ptr; C;
- {
- ******************************************************************************
- BSSetMappingPIPrivateData - sets the Mapping Plug-in's private data
- for a Store
-
- Inputs: accessStore - the Store to set the data in
- privateData - pointer to the data
-
- Outputs: <none>
-
- Returns: <none>
-
- *****************************************************************************
- }
- PROCEDURE BSSetMappingPIPrivateData(accessStore: BSStorePtr; privateData: UNIV Ptr); C;
- {
- ******************************************************************************
- BSGetPartitioningPIPrivateData - retrieves the Partitioning Plug-in's private
- data from a Store
-
- Inputs: accessStore - the Store to retrieve the data from
-
- Outputs: <none>
-
- Returns: pointer to data
-
- *****************************************************************************
- }
- FUNCTION BSGetPartitioningPIPrivateData(accessStore: BSStorePtr): Ptr; C;
- {
- ******************************************************************************
- BSSetPartitioningPIPrivateData - sets the Partitioning Plug-in's private data
- for a Store
-
- Inputs: accessStore - the Store to set the data in
- privateData - pointer to the data
-
- Outputs: <none>
-
- Returns: <none>
-
- *****************************************************************************
- }
- PROCEDURE BSSetPartitioningPIPrivateData(accessStore: BSStorePtr; privateData: UNIV Ptr); C;
- {
- ******************************************************************************
- BSStoreGetNumComponents - Gets the number of component Stores or Devices
- that have been put together into this Store
-
- Inputs: accessStore - the Store to get the number of components from
-
- Outputs: <none>
-
- Returns: number of components
-
- *****************************************************************************
- }
- FUNCTION BSStoreGetNumComponents(accessStore: BSStorePtr): ItemCount; C;
- {
- ******************************************************************************
- BSStoreGetComponents - Gets the information about a particular component
- of a Store
-
- Inputs: accessStore - the Store to get the number of components from
- componentNum - which component to return
-
- Outputs: component - the BSStoreComponent buffer that is filled in
-
- Returns: E_BSSuccess if no problems
-
- *****************************************************************************
- }
- FUNCTION BSStoreGetComponent(accessStore: BSStorePtr; componentNum: ItemCount; component: BSStoreMPIComponentPtr): OSStatus; C;
- {
- ******************************************************************************
- BSStoreSetNumPartitions - sets the number of partitions in the Store
-
- Inputs: accessStore - the Store to get the number of components from
- numPartitions - the new partition count
-
- Outputs: <none>
-
- Returns: <none>
-
- *****************************************************************************
- }
- PROCEDURE BSStoreSetNumPartitions(accessStore: BSStorePtr; numPartitions: ItemCount); C;
- {
- ******************************************************************************
- BSStoreGetPPIConnection - Gets the Store connection for the partitioning
- plug-ins
-
- Inputs: accessStore - the Store to get connection from
-
- Outputs: <none>
-
- Returns: Connection to the Store (kInvalidID if none)
-
- *****************************************************************************
- }
- FUNCTION BSStoreGetPPIConnection(accessStore: BSStorePtr): BSStoreConnID; C;
- {
- ******************************************************************************
- BSStoreGetAccessibilityState - Gets the current accessibility state of the Store
-
- Inputs: accessStore - the Store to get connection from
-
- Outputs: <none>
-
- Returns: Store's state
-
- *****************************************************************************
- }
- FUNCTION BSStoreGetAccessibilityState(accessStore: BSStorePtr): BSAccessibilityState; C;
- {
- ******************************************************************************
- BSStoreSetAccessibilityState - Sets the current accessibility state of the Store
-
- Inputs: accessStore - the Store to get connection from
- setState - the state to set the Store to
-
- Outputs: <none>
-
- Returns: <none>
-
- *****************************************************************************
- }
- PROCEDURE BSStoreSetAccessibilityState(accessStore: BSStorePtr; setState: BSAccessibilityState); C;
- {
- ******************************************************************************
- BSStoreGetMPIInfo - Calls the GetInfo routine of the Mapping plug-in
- attached to the Store
-
- Inputs: accessStore - the Store to get connection from
- info - a pointer to the buffer to put the returned info into
-
- Outputs: <none>
-
- Returns: <none>
-
- *****************************************************************************
- }
- FUNCTION BSStoreGetMPIInfo(accessStore: BSStorePtr; VAR info: BSStoreMPIInfo): OSStatus; C;
- {
- ******************************************************************************
- BSStoreGetPPIInfo - Calls the GetInfo routine of the Partitioning plug-in
- attached to the Store
-
- Inputs: accessStore - the Store to get connection from
- info - a pointer to the buffer to put the returned info into
-
- Outputs: <none>
-
- Returns: <none>
-
- *****************************************************************************
- }
- FUNCTION BSStoreGetPPIInfo(accessStore: BSStorePtr; VAR info: BSStorePPIInfo): OSStatus; C;
- {
- ******************************************************************************
-
- BSMPINotifyFamilyStoreChangedState - called from a Mapping Plug-in (typically
- in the BackgroundTask) to inform the Block Storage Family of an
- unexpected accessibility change, e.g. the media was removed or the disk
- spun down.
-
- Inputs: changedStore - the Store that changed
- newState - the state the Store is now in
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- FUNCTION BSMPINotifyFamilyStoreChangedState(changedStore: BSStorePtr; newState: BSAccessibilityState): OSStatus; C;
- {
- ******************************************************************************
-
- BSMPIRequestStoreStateChange - requests a state change of the Store. This
- should be used, for example, if a device has an eject button that can
- be monitored by the Mapping Plug-in. If the eject button is pressed
- BSMPIRequestStoreStateChange should be used to notify the Family that
- an eject has been requested and the Family can then notify clients and
- flush data to the media properly. This call waits until permission is
- granted or denied by the Expert. The GoToState call of the plug-in
- will be invoked before this calls returns if permission is granted.
-
- Inputs: changeStore - the Store the state change will affect
- requestedState - the state the Store is being requested to go to
-
- Outputs: permission - true if permission was granted and the Store
- successfully went to the State requested.
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- FUNCTION BSMPIRequestStoreStateChange(changeStore: BSStorePtr; requestedState: BSAccessibilityState; VAR permission: BOOLEAN): OSStatus; C;
- {
- ******************************************************************************
-
- BSCPINotifyFamilyContainerChangedState - called from a Container Plug-in
- (typically in the BackgroundTask) to inform the Block Storage Family of
- an unexpected accessibility change, e.g. the media was removed.
-
- Inputs: changedStore - the Store that changed
- newState - the state the Store is now in
-
- Outputs: <none>
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- FUNCTION BSCPINotifyFamilyContainerChangedState(changedContainer: BSContainerPtr; newState: BSAccessibilityState): OSStatus; C;
- {
- ******************************************************************************
-
- BSCPIRequestContainerStateChange - requests a state change of the Container.
- This should be used, for example, if a device has an eject button that
- can be monitored by the Container Plug-in. If the eject button is pressed
- BSCPIRequestStoreStateChange should be used to notify the Family that
- an eject has been requested and the Family can then notify clients and
- flush data to the media properly. This call waits until permission is
- granted or denied by the Expert. The GoToState call of the plug-in
- will be invoked before this calls returns if permission is granted.
-
- Inputs: changeContainer - the Container the state change will affect
- requestedState - the state the Container is being requested to go to
-
- Outputs: permission - true if permission was granted and the Container
- successfully went to the State requested.
-
- Returns: E_BSSuccess if successful
-
- *****************************************************************************
- }
- FUNCTION BSCPIRequestContainerStateChange(changeContainer: BSStorePtr; requestedState: BSAccessibilityState; VAR permission: BOOLEAN): OSStatus; C;
- {$ENDC}
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := BlockStoragePluginIncludes}
-
- {$ENDC} {__BLOCKSTORAGEPLUGIN__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-